package com.ihg.hiex.admin.web.controller.session.during;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.demo2do.core.web.interceptor.MenuSetting;
import com.ihg.hiex.admin.service.session.SessionMeetingService;
import com.ihg.hiex.admin.service.session.SessionService;
import com.ihg.hiex.entity.session.Session;
import com.ihg.hiex.entity.session.meeting.SessionMeeting;
import com.ihg.hiex.entity.user.Assessor;

/**
 * 
 * @author dan
 *
 */
@Controller
@RequestMapping("/sessions/{sessionId}/develope-workshop")
@MenuSetting("menu-sessions")
public class DevelopeWorkshopController {
    
    @Autowired
    private SessionService sessionService;
    
    @Autowired
    private SessionMeetingService sessionMeetingService;
    
    /**
     * Day Three Development Workshop
     * 
     * @param sessionId
     * @return
     */
    @MenuSetting(value = "submenu-session-during-day-three")
    @RequestMapping(path = "", method = RequestMethod.GET)
    public ModelAndView index(@PathVariable("sessionId") Long sessionId) {
        
        ModelAndView modelAndView = new ModelAndView("session/during/develope-workshop/develope-workshop-index");

        // 1. load session
        Session session = sessionService.load(Session.class, sessionId);
        modelAndView.addObject("session", session);
        
        // 2. load meeting
        SessionMeeting meeting = sessionMeetingService.load(session, "Development Workshop");
        modelAndView.addObject("meeting", meeting);
        
        // 3. list assessor
        List<Assessor> assessors = sessionService.listAssessor(session);
        modelAndView.addObject("assessors", assessors);
        
        return modelAndView;
        
    }
    
}
